<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= $page_title ?></title>
    <?php include(APPLICATION_BASE_TPL_PATH . "/inc/include.phtml"); ?>
    <!--include-wechat-start-->
</head>
<body>
<div id="wrapper">
    <?php echo $menuview; ?>
    <div id="page-wrapper" style="min-height: 0;">
        <div class="row">
            <div class="panel panel-default" style="margin-top: 15px;">
                <div class="panel-heading search-panel">
                    <div class="panel-body">
                        <form class="form-horizontal" id="serviceform">
                            <input type="hidden" name="id" id="id" value="<?=$item['id'];?>">
                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="start">开始时间</label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="start" id="start"
                                           value="<?=$item['start'];?>" placeholder="开始时间" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="end">结束时间</label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="end" id="end" placeholder="结束时间" value="<?=$item['end'];?>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="minute">赠送时间</label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="minute" id="minute" value="<?=$item['content']['minute'];?>" placeholder="赠送时间">
                                </div>
                                <div class="col-sm-6">
                                    <p class="form-control-static text-danger">分钟</p>
                                </div>
                            </div>

                            <div class="plane-footer">
                                <button type="button" class="btn btn-primary btn-sm" id="registerupdate">保存</button>
                            </div>
                        </form>
                    </div></div></div>
        </div>


        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

</body>
<script type="text/javascript">

    $('#start, #end').datetimepicker({
        lang:'ch',
        step:60,
        format:"Y-m-d"
    });

    $(function () {

        $("#registerupdate").click(function(){
            var start = $("#start").val(),
                end = $("#end").val(),
                minute   = $("#minute").val();

            if(start == "" || end == "" || minute == ""){
                alert('请检查必填项');
                return false;
            }


            $.post("<?=APP_ADMIN_PATH?>/activity/registerupdate",{start : start, end : end,minute:minute},function(result){
                if(result.retcode == 2000000){
                    alert(result.msg);
                }else{
                    alert('发生错误，保存失败:'+result.retcode);
                }

            });

        });
    });
</script>
</html>
